//
//  AddViewController.swift
//  
//
//  Created by lanou3g on 15/10/6.
//
//

import UIKit

class AddViewController: UIViewController {
    
    override func viewDidLoad() {
        super.viewDidLoad()

        self.title = "添加联系人"
        
        self.view.backgroundColor = UIColor.magentaColor()
        
        //头像
        let headerButton:UIButton = UIButton()
                    
        headerButton.frame = CGRectMake(130, 100, 100, 100)
        
        headerButton.layer.masksToBounds = true
        headerButton.layer.cornerRadius = 50
        
        headerButton.setImage((UIImage (named: "header")), forState: UIControlState.Normal)
        
        headerButton.addTarget(self, action: "changephotoImage", forControlEvents: UIControlEvents.TouchUpInside)
        
        view.addSubview(headerButton)
        
        //名字
        let nameTextField:UITextField = UITextField(frame: CGRectMake(50, 250, 280, 35))
        nameTextField.placeholder = "请输入姓名"
        nameTextField.borderStyle = UITextBorderStyle.RoundedRect
        view.addSubview(nameTextField)
        
        //手机号码
        let keyTextField:UITextField = UITextField(frame: CGRectMake(50, 320, 280, 35))
        keyTextField.placeholder = "请输入电话"
        keyTextField.borderStyle = UITextBorderStyle.RoundedRect
        view.addSubview(keyTextField)
        
        // Do any additional setup after loading the view.
    }
    
    //点击头像响应方法
    func changephotoImage() {
        
        print("换头像咯,和哈哈哈哈")
    }
    
    
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    

    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
        // Get the new view controller using segue.destinationViewController.
        // Pass the selected object to the new view controller.
    }
    */

}
